<template>
    <div>
        <div class="section" >
            <!--热门推荐-->
            <div class="swiper-container"
                 ref="slider" align="center">
                <div class="swiper-wrapper" >
                    <div v-for="s in slides" class="swiper-slide">
                        <img :src="s.img_url"/>
                    </div>
                </div>
                <div class="swiper-pagination"
                     ref="pagination"></div>
            </div>
            <!--快讯-->
            <div class="announcement">
                <label>快讯</label>
                <span>{{announcement}}</span>
            </div>
        </div>
    </div>
</template>
<script type="text/ecmascript-6">
    import 'swiper/dist/css/swiper.css'
    import Swiper from "swiper"

    export default {
        props:['announcement','slides'],
        data(){
            return{

            }
        },
        beforeMount(){
          console.log("slide beforeMounted")
        },
        created(){
            console.log("slide create")
        },
        mounted() {
            console.log("slide mounted")
        window.setTimeout(function(){
            new Swiper('.swiper-container', {
                pagination: '.swiper-pagination',
                paginationClickable: true,
                spaceBetween: 30,
                centeredSlides: true,
                autoplay: 2500,
                autoplayDisableOnInteraction: false
            })
        },100)

    }

    }
</script>